/*
Copyright (c) [2019年5月1日] [吴超]
[MBT_Studio] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
		 http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
#pragma once


#include "PBF解算数据.h"


//#include "build_AdjacentUnit.cuh"



struct S_邻接索引计算 : public S_材质 {

	S_板载缓存**	m_坐标编码参数元素;
	uint16			m_坐标编码参数元素数量;
	//uint16			m_纹理参数数量;
	S_板载缓存**	m_索引排序分配参数元素;
	uint16			m_索引排序分配元素数量;

	S_板载缓存**	m_索引偏移参数元素;
	uint16			m_索引偏移元素数量;

	S_板载缓存**	m_索引排序合并参数元素;
	uint16			m_索引排序合并元素数量;

	S_结构对象指针	m_排序分桶GPU参数set;
	S_结构对象指针	m_排序偏移GPU参数set;
	S_结构对象指针	m_排序合并GPU参数set;




	S_邻接索引计算(S_设备环境& ctx);

	void f_updateGPU参数(S_坐标数据* 数据);


};






struct S_邻接单元构建  {
	E_并行设备	m_解算设备类型;
	//S_邻接数据	m_Data;

	//float32		m_单元大小;
	std::vector<uint32>		m_cpuIndexs;
	std::vector<uint32>		m_cpu索引体素;
	std::vector<uint8>		m_cpuIndexsNum;
	//uint32*		m_cpuIndexs;


	S_邻接单元构建(E_并行设备 device);


	void f_构建粒子GPU邻接单元(vec3* pos, const uint64 num, uint32 线程块大小);
	void f_构建粒子CUP邻接单元(vec3* pos, const uint64 num, uint32 线程块大小);
	void f_toCpu();

	uint32	f_get单元粒子数量(const uvec3& coord);
	S_DomUnitIndex f_get单元粒子索引(const vec3& coord);
	S_DomUnitIndex f_get单元粒子索引(const uvec3& coord);

	bool	f_单元是否有填充(const uvec3& coord);
	//uint64	f_从坐标取索引(const vec3& coord);
	//uint64	f_从坐标取索引(const uvec3& coord);
	

};




